package top.i51213.fastaction;

import android.Manifest;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
import androidx.preference.SwitchPreferenceCompat;

import com.permissionx.guolindev.PermissionX;

import top.i51213.fastaction.util.Util;

public class MainSettingsFragment extends PreferenceFragmentCompat {

    @Override
    public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
        setPreferencesFromResource(R.xml.root_preferences, rootKey);
    }

    public static boolean isUseSelfShare(Context context) {
        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
        return preferences.getBoolean("use_self_share", false)
                && (Build.VERSION.SDK_INT < Build.VERSION_CODES.R
                || Util.checkSelfPermission(context, Manifest.permission.QUERY_ALL_PACKAGES));
    }
}